import Vue from 'vue'
import Router from 'vue-router'
import Login from '../views/Login.vue'
import Home from '../views/Home.vue'
import User from '../views/User/User.vue'
import Roule from '../views/right/Roule.vue'
import Right from '../views/right/Right.vue'
import Categories from '../views/goods/Categories.vue'
import Goods from '../views/goods/Goods.vue'
import List from '../views/goods/GoodsList.vue'
import Add from '../views/goods/GoodsAdd.vue'
import Reports from '../views/reports/Reports.vue'
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/',
      name: 'Home',
      component: Home,
      children: [
        {
          path: 'users',
          name: 'User',
          component: User
        },
        {
          path: 'rights',
          name: 'Right',
          component: Right
        },
        {
          path: 'roles',
          name: 'Roule',
          component: Roule
        },
        {
          path: 'categories',
          name: 'Categories',
          component: Categories
        },
        {
          path: 'goods',
          name: 'Goods',
          component: Goods,
          // 重定向
          redirect: {path: 'goods/list'},
          children: [{
            path: 'list',
            name: 'List',
            component: List
          },
          {
            path: 'add',
            name: 'Add',
            component: Add
          }
          ]
        },
        {
          path: 'reports',
          name: 'Reports',
          component: Reports
        }
      ]
    }
  ]
})
